# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-unirest
pkgname=('python2-unirest' 'python-unirest')
_pkgname=Unirest
pkgver=1.1.7
pkgrel=12
pkgdesc='Simplified, lightweight HTTP client library.'
arch=('any')
url='https://pypi.org/project/unirest/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('bfbd1feddcdb97e951dda51d9654f2efd7d3f1ac0f73d4c024653aee0efad4dd7a25215dadc8c856334ba837cf6489fecd99f77b97b9485f65f333bf9424468f')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-unirest() {
  depends=('python2' 'python2-poster')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-unirest() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

